#! /bin/bash
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
create database if not exists oe_rpt;
use oe_rpt;

drop table if exists rpt_attendance;
create table if not exists rpt_attendance
(
    date_code              date comment '日期',
    class_id               int comment '班级id',
    content                string comment '课程内容',
    studying_student_count int comment '在读人数',
    time_type              varchar(10) comment '时间类型',
    attendance_count       bigint comment '出勤人数',
    attendance_ratio       decimal(22, 2) comment '出勤率',
    late_count             bigint comment '迟到人数',
    late_ratio             decimal(22, 2) comment '迟到率',
    leave_count            bigint comment '请假人数',
    leave_ratio            decimal(22, 2) comment '请假率',
    absent_count           bigint comment '旷课人数',
    absent_ratio           decimal(22, 2) comment '旷课率'
) comment '考勤主题报表'
    row format delimited
        fields terminated by '\t'
    stored as orc
    tblproperties ('orc.compress' = 'SNAPPY');"